package cn.itcast.hotel.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description: 配置 ES 的客户端
 * @Version: V1.0
 */
@Configuration
public class EsConfig {

    //@Autowired
    //EsProperties esProperties;

    @Bean
    public RestHighLevelClient client(EsProperties esProperties) {
       return new RestHighLevelClient(
                RestClient.builder(
                        new HttpHost(esProperties.getHost(),
                                esProperties.getPort())));
    }

}
